/**
 * AI 聊天界面样式
 * 作者：衡森 QQ：191118032 微信：huangsentianzhenkeai
 */

.chat-test {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f5f5f5;

  .header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .title {
      font-size: 40px;
      font-weight: bold;
    }

    .actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;

      .btn {
        padding: 6px 12px;
        border: none;
        border-radius: 15px;
        font-size: 26px;
        background-color: rgba(255, 255, 255, 0.2);
        color: white;
        white-space: nowrap;

        &:hover:not(:disabled) {
          background-color: rgba(255, 255, 255, 0.3);
        }

        &:disabled {
          opacity: 0.4;
          background-color: rgba(255, 255, 255, 0.1);
        }
      }
    }
  }

  .system-prompt {
    background-color: white;
    padding: 15px;
    border-bottom: 1px solid #eee;

    .label {
      font-size: 32px;
      color: #666;
      margin-bottom: 8px;
      display: block;
    }

    .system-input {
      width: 100%;
      padding: 10px 14px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 30px;
      background-color: #f9f9f9;

      &:focus {
        border-color: #667eea;
        outline: none;
      }
    }
  }

  .messages {
    flex: 1;
    padding: 15px;
    background-color: #f5f5f5;

    .message {
      display: flex;
      margin-bottom: 15px;
      align-items: flex-start;

      &.user {
        flex-direction: row-reverse;

        .avatar {
          margin-left: 10px;
          margin-right: 0;
        }

        .content {
          background-color: #667eea;
          color: white;
          align-items: flex-end;

          .time {
            color: rgba(255, 255, 255, 0.7);
          }
        }
      }

      &.ai {
        .avatar {
          margin-right: 10px;
        }

        .content {
          background-color: white;
          color: #333;
        }
      }

      .avatar {
        width: 36px;
        height: 36px;
        border-radius: 18px;
        background-color: #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        flex-shrink: 0;
      }

      .content {
        max-width: 70%;
        padding: 12px 16px;
        border-radius: 18px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;

        .text {
          font-size: 32px;
          line-height: 1.5;
          margin-bottom: 4px;
          word-wrap: break-word;

          .cursor {
            animation: blink 1s infinite;
            color: #667eea;
            font-weight: bold;
          }
        }

        .time {
          font-size: 24px;
          color: #999;
          align-self: flex-end;
        }
      }
    }
  }

  .input-area {
    background-color: white;
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;

    .voice-btn {
      width: 50px;
      height: 50px;
      border: none;
      border-radius: 25px;
      background-color: #52c41a;
      color: white;
      font-size: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      flex-shrink: 0;

      &:active:not(:disabled) {
        background-color: #ff4d4f;
        transform: scale(0.95);
      }

      &:disabled {
        background-color: #d9d9d9;
        cursor: not-allowed;
        opacity: 0.6;
      }
    }

    .stop-voice-btn {
      width: 45px;
      height: 45px;
      border: none;
      border-radius: 22.5px;
      background-color: #ff4d4f;
      color: white;
      font-size: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      flex-shrink: 0;
      animation: pulse 1.5s ease-in-out infinite;

      &:active {
        background-color: #cf1322;
        transform: scale(0.95);
      }
    }

    .input {
      flex: 1;
      padding: 12px 16px;
      border: 1px solid #ddd;
      border-radius: 25px;
      font-size: 32px;
      background-color: #f9f9f9;

      &:focus {
        border-color: #667eea;
        outline: none;
      }

      &:disabled {
        opacity: 0.6;
      }
    }

    .send-btn {
      padding: 12px 20px;
      border: none;
      border-radius: 25px;
      background-color: #667eea;
      color: white;
      font-size: 32px;
      font-weight: bold;

      &:hover:not(:disabled) {
        background-color: #5a6fd8;
      }

      &:disabled {
        background-color: #ccc;
        cursor: not-allowed;
      }
    }
  }

  .status {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-top: 1px solid #eee;

    .status-text {
      font-size: 26px;
      color: #666;
      text-align: center;
    }
  }
}

// 流式光标闪烁动画
@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

// 脉冲动画（用于播放按钮）
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .chat-test {
    .header {
      padding: 12px 15px;

      .title {
        font-size: 36px;
      }

      .actions {
        .btn {
          padding: 6px 12px;
          font-size: 26px;
        }
      }
    }

    .system-prompt {
      padding: 12px;

      .label {
        font-size: 30px;
      }

      .system-input {
        font-size: 28px;
      }
    }

    .messages {
      padding: 12px;

      .message {
        .avatar {
          width: 32px;
          height: 32px;
          font-size: 14px;
        }

        .content {
          max-width: 80%;
          padding: 10px 14px;

          .text {
            font-size: 30px;
          }

          .time {
            font-size: 22px;
          }
        }
      }
    }

    .input-area {
      padding: 12px;

      .voice-btn {
        width: 45px;
        height: 45px;
        font-size: 36px;
      }

      .stop-voice-btn {
        width: 40px;
        height: 40px;
        font-size: 32px;
      }

      .input {
        padding: 10px 14px;
        font-size: 30px;
      }

      .send-btn {
        padding: 10px 16px;
        font-size: 30px;
      }
    }

    .status {
      padding: 6px 12px;

      .status-text {
        font-size: 24px;
      }
    }
  }
}

